@extends('admin.layout.common')
@section('content')
    <link rel="stylesheet" type="text/css" href="{{URL::asset('css/app.css')}}">
    <link rel="stylesheet" type="text/css" href="{{URL::asset('common/js/multiple-select-master/multiple-select.css')}}">
    <script src="{{URL::asset('common/js/multiple-select-master/multiple-select.js')}}"></script>
    <link rel="stylesheet" type="text/css" href="{{URL::asset('css/music/musicReport.css')}}">
    <style>
        header ul li:last-child img {
            width: 30px;
            transform: translateY(0%);
        }
    </style>
    <div class="content">
        <h1 class="pageTitle h1">音乐作品统计</h1>
        <ul class="checkboxUl displayFlex flex-wrap">
            <li><label><input name="music_check" type="checkbox" value="music_1">库</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_2">作品级别</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_3">性质</label></li>
            {{--<li><label><input name="music_check" type="checkbox" value="music_4">授权描述</label></li>--}}
            {{--<li><label><input name="music_check" type="checkbox" value="music_5">资源</label></li>--}}
            <li><label><input name="music_check" type="checkbox" value="music_6">上传编辑</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_7">音乐审核编辑</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_8">上线时间</label></li>
            {{--<li><label><input name="music_check" type="checkbox" value="music_9">SP编辑</label></li>--}}
            <li><label><input name="music_check" type="checkbox" value="music_0">上线类型</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_11">平台</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_12">推荐</label></li>
            {{--<li><label><input name="music_check" type="checkbox" value="music_13">首发</label></li>--}}
            <li><label><input name="music_check" type="checkbox" value="music_14">首发时间</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_15">收入</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_16">授权文件</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_17">特殊授权</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_18">歌手类型</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_19">语种</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_20">风格</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_21">地区</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_22">情绪</label></li>
            <li><label><input name="music_check" type="checkbox" value="music_23">速度</label></li>
        </ul>
        <form action="{{url('admin/musicList')}}" method="get" class="form1">
            {{csrf_field()}}
            <div class="Flex-between">
                <div class="formBox">
                    <p>
                        <label>作品名：<input type="text" name="title" placeholder="请输入"></label>
                        <label>专辑名：<input type="text" name="album" placeholder="请输入"></label>
                        <label>表演者：<input type="text" name="performer" placeholder="请输入"></label>
                        <label for="">上线时间：<input type="date" name="online_time"></label>
                        <label>性质：<input type="text" placeholder="原唱" name="property"></label>
                        {{--<label for="">代理选择：<select name="agent_type">--}}
                                {{--<option value="">--请选择--</option>--}}
                                {{--<option value="1">录音棚</option>--}}
                                {{--<option value="2">cp公司</option>--}}
                                {{--<option value="3">业内达人</option>--}}
                                {{--<option value="4">老师</option>--}}
                                {{--<option value="5">制作人</option>--}}
                                {{--<option value="6">独立音乐人</option>--}}
                                {{--<option value="7">乐手</option>--}}
                                {{--<option value="8">词曲人</option>--}}
                                {{--<option value="9">媒体人</option>--}}
                                {{--<option value="10">自媒体</option>--}}
                                {{--<option value="11">正规媒体</option>--}}
                                {{--<option value="12">软件渠道</option>--}}
                                {{--<option value="13">网红达人</option>--}}
                                {{--<option value="14">经纪人</option>--}}
                            {{--</select>--}}
                        {{--</label>--}}
                    </p>
                    <p>
                        <label for="">库：
                            <select name="library">
                                <option value="">--请选择--</option>
                                <option value="1">常规库</option>
                                <option value="2">保护库</option>
                                <option value="3">自有库</option>
                                <option value="4">买断库</option>
                            </select>
                        </label>
                        <label for="">作品级别：<select name="work_rate">
                                <option value="">--请选择--</option>
                                <option value="1">A类</option>
                                <option value="2">B类</option>
                                <option value="3">舞曲</option>
                            </select></label>
                        <label for="">审核编辑：<select name="check_man">
                                <option value="">--请选择--</option>
                                @foreach($check_man as $v)
                                    <option value="{{$v['check_man']}}">{{$v['check_man']}}</option>
                                @endforeach
                            </select></label>
                        <label for=""><input type="radio" name="type_status" class="Radio">首发歌曲</label>
                        <label for=""><input type="radio" name="is_commond" class="Radio">推荐歌曲</label>
                        <label for=""><input type="radio" name="expired_time" class="Radio">签约已到期</label>
                        <label for=""><input type="radio" name="expired_time3" class="Radio">签约1个月内到期</label>
                    </p>
                </div>
                <div class="btn_box">
                    <button type="submit" class="shaixuan">筛选</button>
                    <button type="button" class="daochu" onclick="exportExcel()">导出Excel</button>
                </div>
            </div>
        </form>
        <form action="">
            <div class="Checkbox">
                <label for="">
                    高级搜索：
                    <select name="in_sp[]" id="include" multiple="multiple" required>
                        @foreach($sp as $v)
                            <option value="{{$v['id']}}">{{$v['simple_name']}}</option>
                        @endforeach
                    </select>
                </label>
                <label for="">
                    <img src="../../../images/icon/连接.png" alt="" class="lianjie">
                    <select name="not_sp[]" id="uninclude" multiple="multiple" required>>
                        @foreach($sp as $v)
                            <option value="{{$v['id']}}">{{$v['simple_name']}}</option>
                        @endforeach
                    </select>
                </label>
                <button type="submit" class="shaixuan">筛选</button>
            </div>
        </form>
        <div class="table_box">
            <table border="1">
                <tr>
                    <th>KID</th>
                    <th>作品名</th>
                    <th>专辑名</th>
                    <th>表演者</th>
                    <th>伴奏</th>
                    <th>短音频</th>
                    <th>MV</th>
                    <th>卡拉OK</th>
                    <th class="shows music_1">库</th>
                    <th class="shows music_2">作品级别</th>
                    <th class="shows music_3">性质</th>
                    {{--<th class="shows music_4">授权描述</th>--}}
                    {{--<th class="shows music_5">资源</th>--}}
                    <th class="shows music_6">上传编辑</th>
                    <th class="shows music_7">音乐审核编辑</th>
                    <th class="shows music_8">上线时间</th>
                    {{--<th class="shows music_9">SP编辑</th>--}}
                    <th class="shows music_0">上线类型</th>
                    <th class="shows music_11">平台</th>
                    <th class="shows music_12">推荐</th>
                    {{--<th class="shows music_13">首发</th>--}}
                    <th class="shows music_14">首发时间</th>
                    <th class="shows music_15">收入</th>
                    <th class="shows music_16">授权文件</th>
                    <th class="shows music_17">特殊授权</th>
                    <th class="shows music_18">歌手类型</th>
                    <th class="shows music_19">语种</th>
                    <th class="shows music_20">风格</th>
                    <th class="shows music_21">地区</th>
                    <th class="shows music_22">情绪</th>
                    <th class="shows music_23">速度</th>
                </tr>
                @foreach($list as $v)
                <tr>
                    <td>{{$v['id']}}</td>
                    <td>{{$v['title']}}</td>
                    <td>{{$v['album']}}</td>
                    <td>{{$v['performer']}}</td>
                    @if(!empty($v['accompaniment_file_uuid']))
                        <td>√</td>
                    @else
                        <td>/</td>
                    @endif
                    @if(!empty($v['video_file_uuid']))
                        <td>√</td>
                    @else
                        <td>/</td>
                    @endif
                    @if(!empty($v['mv_file_uuid']))
                        <td>√</td>
                    @else
                        <td>/</td>
                    @endif
                    @if(!empty($v['karaoke_file_uuid']))
                        <td>√</td>
                    @else
                        <td>/</td>
                    @endif
                    <td  class="shows music_1">{{$v['music_check']['library']}}</td>
                    <td  class="shows music_2">{{$v['music_check']['work_rate']}}</td>
                    <td  class="shows music_3">{{$v['property']}}</td>
                    {{--<td>任贤齐</td>--}}
                    <td class="shows music_6">{{$v['created_at']}}</td>
                    <td class="shows music_7">{{$v['check_man']}}</td>
                    <td class="shows music_8">{{$v['online_time']}}</td>
                    {{--<td class="shows music_11">{{$v['users_info']['sp']['check_man']}}</td>--}}
                    <td class="shows music_0">{{$v['type_status_text']}}</td>
                    <td class="shows music_11" onclick=sp({{$v['id']}})>查看详情</td>
                    <td class="shows music_12">{{$v['music_check']['is_commond_text']}}</td>
                    <td class="shows music_14">{{$v['music_check']['start_time']?$v['music_check']['start_time']:'/'}}</td>
                    <td class="shows music_15">/</td>
                    {{--<td>24234134342</td>--}}
                    <td class="shows music_16" onclick=author({{$v['id']}})>查看详情</td>
                    <td class="shows music_17" onclick=special({{$v['id']}})>{{$v['type_status']==3?'查看详情':'/'}}</td>
                    <td class="shows music_18">{{$v['music_check']['singer_type']}}</td>
                    <td class="shows music_19">{{$v['music_check']['language']}}</td>
                    <td class="shows music_20">{{$v['music_check']['style']}}</td>
                    <td class="shows music_21">{{$v['music_check']['area']}}</td>
                    <td class="shows music_22">{{$v['music_check']['mood']}}</td>
                    <td class="shows music_23">{{$v['music_check']['speed']}}</td>
                </tr>
                @endforeach
            </table>
        </div>
        {{$list->appends([
            'title' => $_GET['title'] ?? '',
            'album' => $_GET['album'] ?? '',
            'performer' => $_GET['performer'] ?? '',
            'online_time' => $_GET['online_time'] ?? '',
            'property' => $_GET['property'] ?? '',
            'agent_type' => $_GET['agent_type'] ?? '',
            'library' => $_GET['library'] ?? '',
            'work_rate' => $_GET['work_rate'] ?? '',
            'check_man' => $_GET['check_man'] ?? '',
            'type_status' => $_GET['type_status'] ?? '',
            'is_commond' => $_GET['is_commond'] ?? '',
            'expired_time' => $_GET['expired_time'] ?? '',
            'expired_time3' => $_GET['expired_time3'] ?? '',
            'in_sp' => $_GET['in_sp'] ?? '',
            'not_sp' =>$_GET['not_sp'] ?? '',
         ])->links()}}
    </div>
<script type="text/javascript" src="//at.alicdn.com/t/font_809874_lzrjua7w53k.js"></script>
{{--<script type="text/javascript" src="{{URL::asset('js/music/musicReport.js')}}"></script>--}}
<script type="text/javascript" src="{{URL::asset('js/music/MusicStatistics.js')}}"></script>
<script>
    // 多选
    $(function() {
        $('#include').change(function() {
            console.log($(this).val());
        }).multipleSelect({
            width: '240px',
            height: '40px'
        });
        $('#uninclude').change(function() {
            console.log($(this).val());
        }).multipleSelect({
            width: '240px'
        });
    });
 function getTask(){
     $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/musicGetTask', function (data) {
         if(data[0]['id']) {
             var tr = '';
             $('.checktable').text(tr);
             for (var i = 0; i < data.length; i++) {
                 tr += "<tr onclick=detail(" + data[i]['id'] + ") id=tr"+ data[i]['id'] +"><td>" + data[i]['performer'] + "</td><td>" + data[i]['property'] + "</td><td>" + data[i]['created_at'] + "</td>"
             }
         }else{
             tr = '<tr><td>无任务</td></tr>';
         }
         $('.checktable').append(tr);
     })
 }
 function detail(id){
     $(".checktable tr").css('background','#fff');
     $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/musicDetail/'+id,function(data){
         if(data[0]['id']) {
             $(".detail1").text(data[0]['title']);
             $(".detail2").text(data[0]['performer']);
             $(".detail3").text(data[0]['writer']);
             $(".detail4").text(data[0]['composer']);
             $(".detail5").text(data[0]['album']);
             $(".detail6").text(data[0]['neighboring_right_1']);
             $(".detail7").text(data[0]['neighboring_right_2']);
             $(".detail8").text(data[0]['neighboring_right_3']);
             $(".detail9").attr('src',data[0]['cover']);
             $(".detail14").text(data[0]['lyrics']);
             $(".detail15").text(data[0]['description']);
             $(".detail16").attr('src', data[0]['music_file']['local_path']);
             if(data[0]['accompaniment_file']) {
                 $("input[name='accompaniment_file_uuid']").val(data[0]['accompaniment_file_uuid']);
                 $(".detail17").attr('src', data[0]['accompaniment_file']['local_path']);
             }
             if(data[0]['video_file']) {
                 $("input[name='video_file_uuid']").val(data[0]['video_file_uuid']);
                 $(".detail18").attr('src', data[0]['video_file']['local_path']);
             }
             if(data[0]['mv_file']) {
                 $("input[name='mv_file_uuid']").val(data[0]['mv_file_uuid']);
                 $(".detail19").attr('src', data[0]['mv_file']['local_path']);
             }
             if(data[0]['karaoke_file']) {
                 $("input[name='karaoke_file_uuid']").val(data[0]['karaoke_file_uuid']);
                 $(".detail20").attr('src', data[0]['karaoke_file']['local_path']);
             }
             $("#tr"+id).css('background','#CF2121');
             $("input[name='id']").val(id);
             $("input[name='album_id']").val(data[0]['album_id']);
             $("input[name='music_file_uuid']").val(data[0]['music_file_uuid']);
         }
     })
 }

 function back(){
     $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/reiterateMusic', function (data) {
         if(data[0]['id']) {
             var tr = '';
             $('.backcheck').text(tr);
             for (var i = 0; i < data.length; i++) {
                 tr += "<tr onclick=detail(" + data[i]['id'] + ") id=tr"+ data[i]['id'] +"><td>" + data[i]['performer'] + "</td><td>" + data[i]['property'] + "</td><td>" + data[i]['created_at'] + "</td>"
             }
         }else{
             tr = '<tr><td>无任务</td></tr>';
         }
         $('.backcheck').append(tr);
     })
 }
 // table中列的显示隐藏
 $(document).ready(function() {
     //checked复选框控制相应div的显/隐
     $("input[name='music_check']").each(function () {
         $(this).click(function () {
             //if(this.checked){
             if ($(this).prop("checked") == true) {
                 $("." + $(this).val()).show();
                 //$(this).attr("checked",true);
             } else {
                 $("." + $(this).val()).hide();
                 //$(this).attr("checked",false);
             }
         });
     });
 });

 //查看平台
function sp(id){
    layer.open({
        type: 2,
        shadeClose: true, //点击遮罩关闭
        area: ['400px', '400px'], //宽高
        content: "http://{{$_SERVER['HTTP_HOST']}}/admin/showSp/"+id
    });
}

//查看授权文件
function author(id){
    layer.open({
        type: 2,
        shadeClose: true, //点击遮罩关闭
        area: ['400px', '400px'], //宽高
        content: "http://{{$_SERVER['HTTP_HOST']}}/admin/author/"+id
    });
}

//查看特殊授权
function special(id){
    layer.open({
        type: 2,
        shadeClose: true, //点击遮罩关闭
        area: ['400px', '400px'], //宽高
        content: "http://{{$_SERVER['HTTP_HOST']}}/admin/showSpecial/"+id
    });
}

//导出表格
function exportExcel(){
    window.location.href = '{{url('/admin/exportMusicList')}}';
}
</script>
@endsection

